from django.db import models

# Create your models here.
class College(models.Model):
    name = models.CharField("学院名称", max_length=100, unique=True)


# 专业表（隶属于学院）
class Major(models.Model):
    name = models.CharField("专业名称", max_length=100)
    college = models.ForeignKey(College, on_delete=models.CASCADE)


# 班级表
class Class(models.Model):
    class_id = models.CharField("班级号", max_length=20, primary_key=True)
    major = models.ForeignKey(Major, on_delete=models.CASCADE)
    grade = models.CharField("年级", max_length=20)  # 如"大一"
    student_count = models.IntegerField("人数")
    counselor = models.ForeignKey('teacherapp.Teacher', on_delete=models.SET_NULL, null=True)